
#pragma once

#include <AVUIModel3D.h>

namespace AVUI {

class Geometry3D;
class Material;

class GeometryModel3D : public Model3D
{
public:
    GeometryModel3D() { };

    DECLARE_ELEMENT(GeometryModel3D, Model3D);

    DECLARE_DEPENDENCY_PROPERTY(Geometry);
    TRefCountedPtr<Geometry3D> get_Geometry() { return (Geometry3D*)(Object*)GetValue(get_GeometryProperty()); }
    void set_Geometry(Geometry3D* pValue) { SetValue(get_GeometryProperty(), (Object*)pValue); } 

    DECLARE_DEPENDENCY_PROPERTY(Material);
    TRefCountedPtr<Material> get_Material() { return (Material*)(Object*)GetValue(get_MaterialProperty()); }
    void set_Material(Material* pValue) { SetValue(get_MaterialProperty(), (Object*)pValue); } 

    DECLARE_DEPENDENCY_PROPERTY(BackMaterial);
    TRefCountedPtr<Material> get_BackMaterial() { return (Material*)(Object*)GetValue(get_BackMaterialProperty()); }
    void set_BackMaterial(Material* pValue) { SetValue(get_BackMaterialProperty(), (Object*)pValue); } 

    // Transform 3D property here

    virtual void Render3D(Renderer* pRenderer, const Matrix3D& parentMatrix);
    virtual void RenderDependencies3D(Renderer* pRenderer);

    virtual Rect3D CalculateSubgraphBoundsInnerSpace() AVUI_OVERRIDE; 
    virtual void RayHitTestCore(RayHitTestParameters* pRayParams) AVUI_OVERRIDE;

protected:
    virtual TRefCountedPtr<Freezable> CreateInstanceCore() AVUI_OVERRIDE { return object_allocate<GeometryModel3D>().get_Ptr(); }

private:
    static void StaticConstructor();

};


}; // namespace AVUI
